home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / gtgettext.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-04-06  |  4.3 KB  |  93 lines

  1. /*
  2. For general Scribus (>=1.3.2) copyright and licensing information please refer
  3. to the COPYING file provided with the program. Following this notice may exist
  4. a copyright and/or license notice that predates the release of Scribus 1.3.2
  5. for which a new license (GPL+exception) is in place.
  6. */
  7. /***************************************************************************
  8.  *   Copyright (C) 2004 by Riku Leino                                      *
  9.  *   tsoots@gmail.com                                                      *
  10.  *                                                                         *
  11.  *   This program is free software; you can redistribute it and/or modify  *
  12.  *   it under the terms of the GNU General Public License as published by  *
  13.  *   the Free Software Foundation; either version 2 of the License, or     *
  14.  *   (at your option) any later version.                                   *
  15.  *                                                                         *
  16.  *   This program is distributed in the hope that it will be useful,       *
  17.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
  18.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
  19.  *   GNU General Public License for more details.                          *
  20.  *                                                                         *
  21.  *   You should have received a copy of the GNU General Public License     *
  22.  *   along with this program; if not, write to the                         *
  23.  *   Free Software Foundation, Inc.,                                       *
  24.  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  25.  ***************************************************************************/
  26.  
  27. #ifndef GTGETTEXT_H
  28. #define GTGETTEXT_H
  29.  
  30. #include <iostream>
  31. #include <vector>
  32.  
  33. #include <QDir>
  34. #include <QMap>
  35. #include <QObject>
  36. #include <QString>
  37. #include <QStringList>
  38.  
  39. #include "scconfig.h"
  40. #include "scribusapi.h"
  41. #include "scfonts.h"
  42.  
  43. class PageItem;
  44. class ScribusDoc;
  45. class gtDialogs;
  46.  
  47. // A struct for holding the Importer specific information.
  48. struct ImporterData {
  49.     QString     soFilePath;            // Path to the Importer
  50.     QString     fileFormatName;        // Name of the Importer
  51.     QStringList fileEndings;        // Array of filenames supported by the importer
  52. };
  53.  
  54. // A Struct for holding the results of the File selection Dialog
  55. struct ImportSetup {
  56.     bool runDialog;                    // Did the dialog run correctly?
  57.     int importer;                    // Which importer was selected?
  58.     QString filename;                // What filename is to be loaded?
  59.     bool textOnly;                    // Do we import as text only?
  60.     QString encoding;                // File encoding
  61. };
  62.  
  63. /*
  64.     GetText handles the open file dialog and importer plugins loading and launching.
  65. */
  66. class SCRIBUS_API gtGetText
  67. {
  68. private:
  69.     std::vector<ImporterData> importers;        // Vector of the loaded importers
  70.     QMap<QString, ImporterData*> importerMap;     // QMap of the supported extensions to their relevant importers entry for easy access
  71.     void loadImporterPlugins();                    // Find the available plugins based on the environment, validate they load, and 
  72.                                                 // create quick lookup mappings.
  73.     void CallDLL(const ImporterData& idata, const QString& filePath,
  74.                  const QString& encoding, bool textOnly, bool append, PageItem* importItem);
  75.                                                 // Loads, validates, and executes the Importer code.
  76.     bool DLLName(QString name, QString *ffName, QStringList *fileEndings);
  77.                                                 // Loads the "DLL", validates the importer is good, populates the passed parameters with 
  78.                                                 // the plugin information.
  79.     void createMap();                            // Create the importer Qmap.
  80.     gtDialogs* dias;                            // File Selection Dialog pointer.
  81.     QStringList ilist;                            // List of supported importers, used with dialogs
  82.     ScribusDoc* m_Doc;                            // Which document are we working with.
  83. public:
  84.     gtGetText(ScribusDoc* doc);                    // Constructor
  85.     ~gtGetText();                                // Destructor
  86.     ImportSetup run();                            // Creates the dialog for the user to import a file based on the supported file formats.
  87.     void launchImporter(int importer, const QString& filename, bool textOnly, const QString& encoding, bool append, PageItem* target=0);
  88.                                                 // Look at the results of the file selection dialog and figure out if you need to use an importer.
  89.                                                 // Prompt the user if the importer to use isn't obvious.
  90. };
  91.  
  92. #endif
  93.